import { defineComponent, Fragment, ref, onMounted } from 'vue'
import './map.scss'


export default defineComponent({
  setup() {
    const mapContainer = ref()
    const setMap = () => {
      const map = new BMapGL.Map(mapContainer.value)
      const point = new BMapGL.Point(116.404, 39.915)
      const navi3DCtrl = new BMapGL.NavigationControl3D() // 设置 3D 地图
      map.setMapType(BMAP_SATELLITE_MAP) // 变更地图类型
      map.enableScrollWheelZoom() // 开启滚轮缩放
      map.addControl(navi3DCtrl) // 开启 3D 地图
      map.centerAndZoom(point, 15)
    }
    onMounted(() => {
      setMap()
    })
    return () => (
      <Fragment>
        <div id="container" ref={mapContainer}></div>
      </Fragment >
    )
  }
})